package cc.lucien.service;

import cc.lucien.entity.Goods;
import cc.lucien.repository.GoodsRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GoodsService {

    @Autowired
    private GoodsRepository goodsRepository;

    public List<Goods> findAll() {
        return goodsRepository.findAll();
    }

    public Goods findById(Integer id) {
        return goodsRepository.findById(id);
    }

    public int save(Goods goods) {
        return goodsRepository.save(goods);
    }

    public int update(Goods goods) {
        return goodsRepository.update(goods);
    }

    public int deleteById(Integer id) {
        return goodsRepository.deleteById(id);
    }
}
